function x = coord(AB,BC,CA,DA,DB,DC)
% Function that plots 4 points from 6 distances

Cx=(AB^2+CA^2-BC^2)/(2*AB);
Cy=sqrt(CA^2-Cx^2);

Dx=(AB^2+DA^2-DB^2)/(2*AB);
Dypos=sqrt(DA^2-Dx^2);
Dyneg=-sqrt(DA^2-Dx^2);

Dy=Dyneg;
if(abs((Dx-Cx)^2+(Dypos-Cy)^2-DC^2)<=0.1)
    Dy=Dypos;
end

A=[0,0];
B=[AB,0];
C=[Cx,Cy];
D=[Dx,Dy];
x=[A;B;C;D];
plotmatrix(x(:,1),x(:,2))
shg
end

